﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Xsl;
using System.IO;
using System.Data;

namespace BOAcademias
{

    /*************************************
    Autor: Carlos Sánchez
    Fecha de Creación: 06/02/2011
    Descripción de la Funcionalidad: Clase que contiene metodos generales.
    **************************************/

    public class BOMetodos
    {

        public void CreateWorkbook(DataSet ds, String path)
        {
           XmlDataDocument xmlDataDoc = new XmlDataDocument(ds);
           XslTransform xt = new XslTransform();
           StreamReader reader = new StreamReader(typeof(BOMetodos).Assembly.GetManifestResourceStream(typeof(BOMetodos), "Excel.xsl"));
           XmlTextReader xRdr = new XmlTextReader(reader);
           xt.Load(xRdr, null, null);

           StringWriter sw = new StringWriter();
           xt.Transform(xmlDataDoc, null, sw, null);

           StreamWriter myWriter = new StreamWriter (path + "\\Report.xls");
           myWriter.Write (sw.ToString());
           myWriter.Close ();
        }
     

    }
}
